home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume91 / devices / yes_1_0 / part01 / c.a next >
Text File  |  1991-05-08  |  1KB  |  59 lines

  1. * this be my startup, though I took much of it from elsewhere.
  2. * Eric Lee Green, 2/91
  3.  
  4.         INCLUDE "exec/types.i"
  5.         INCLUDE "exec/memory.i"
  6.         INCLUDE "exec/execbase.i"
  7.  
  8. FUNCDEF         MACRO   * function
  9. _LVO\1          EQU     FUNC_CNT
  10. FUNC_CNT        SET     FUNC_CNT-6
  11.                 ENDM
  12.  
  13. FUNC_CNT        SET     LIB_NONSTD
  14.         INCLUDE "exec/exec_lib.i"
  15.  
  16.         xref    LinkerDB        * linker defined base value
  17.         xref    _BSSBAS         * linker defined base of BSS
  18.         xref    _BSSLEN         * linker defined length of BSS
  19.  
  20.         section text,code
  21.  
  22.         xref    @_main
  23.  
  24. start:
  25.         movem.l d1-d6/a0-a6,-(a7)
  26.  
  27.         move.l  a0,a2
  28.         move.l  d0,d2
  29.         lea     LinkerDB,a4
  30.  
  31.         lea     _BSSBAS,a3
  32.         moveq   #0,d1
  33.         move.l  #_BSSLEN,d0
  34.         bra.s   clr_lp
  35. clr_bss move.l  d1,(a3)+
  36. clr_lp  dbf     d0,clr_bss
  37.         move.l  a7,_StackPtr(A4)
  38.         move.l  04,a6
  39.         move.l  a6,SysBase(A4)
  40. main
  41.         jsr     @_main(PC)              * call C entrypoint
  42.  
  43. ; NOTE: We're never intended to return from here! So the following
  44. ; should *NEVER* be executed!
  45.  
  46.         move.l _StackPtr(A4),a7
  47.         movem.l (a7)+,d1-d6/a0-a6       * restore registers
  48.         moveq  #0,d0
  49.         rts
  50.  
  51.         section __MERGED,BSS
  52.  
  53.         xdef    NULL,SysBase
  54.  
  55. NULL            ds.b    4       *
  56. SysBase         ds.b    4
  57. _StackPtr       ds.b    4
  58.                 END
  59.